#ifndef __H_CLIENTHANDLER_H__
#define __H_CLIENTHANDLER_H__

#include "CCSocketHandler.h"
#include "ICC_Timer_Handler.h"
#include "global.h"
#include "Packet.h"
#include <map>

#define  HEART_BEATT_CMD       (0x6FFF)
#define  HEART_BEATT_TIME_ID   (0x1AAAFFFF)
#define  HEART_BEATT_TIME_OUT  (90)


class CClientHandler : public CCSocketHandler, public TimerOutEvent
{
public:
	CClientHandler();
	virtual ~CClientHandler();

public:
	int GetFD() { return netfd; }
	virtual int Init();
	int Send(CCPacketBase* pPacket);
	virtual int OnClose();
	virtual int OnConnected();
	virtual int OnPacketComplete(const char * data, int len);
	virtual int ProcessOnTimerOut(int Timerid);
	connType getConnType(void)
	{
		return CONN_TYPE_ACCEPT;
	}
public:
	TcpListener* m_pListener;
	ICC_Decoder*  CreateDecoder();
	CCTimer m_heat_beat_timer;
	unsigned int m_HandlerID;
};

typedef std::map<unsigned int, CClientHandler*>  CCHandlerMap;

#endif

